<?php
	include('./fullrss.php');

	define('MAX_ITEMS',150);
	define('MAX_FETCH',50);

	$url='http://www.cnbeta.com/backend.php';
	$initData="<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<rss version=\"2.0\">\r\n<channel>\r\n<title>cnBeta.COM</title>\r\n<link>http://www.cnbeta.com</link>\r\n<description>cnBeta.COM - 简明IT新闻,网友媒体与言论平台</description>\r\n<pubDate>Fri, 09 Apr 2010 14:28:01 GMT</pubDate>\r\n<language>zh-CN</language>\r\n<image>\r\n<link>http://www.cnbeta.com</link>\r\n<url>http://www.cnbeta.com/images/logo.gif</url>\r\n<title>cnBeta.COM</title>\r\n</image>\r\n</channel>\r\n</rss>\r\n";
	$cacheDir='./cache';
	$cacheFile='cnbeta.xml';
	$lockFile='cnbeta.lock';

	$feed=new FullRSS($url, $initData, $cacheDir, $cacheFile, $lockFile);
	$feed->GetFullRSS();

	function GetItem($link)
	{
		if($content = file_get_contents($link))
		{
			//$content=mb_convert_encoding($content, 'UTF-8', 'GB2312');
			$content=iconv('GB18030', 'UTF-8//IGNORE', $content);
			if($content != '')
			{
				$description=explode('<div class="digbox">',$content);
				if($description[0] != '')
				{
					$description=explode('<div id="news_content">',$description[0]);
					if(array_key_exists(1, $description))
						return $description[1];
					else
						return $description[0];
				}
			}
		}
		return '';
	}
?>
